package com.example.service.impl;



import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.dao.UserMapper;
import com.example.entity.User;
import com.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> getAll() {

        return userMapper.getAll();
    }
    @Override
    public List<User> getUserList(User user) {
        QueryWrapper queryWrapper=new QueryWrapper<User>();
        //构造器
        queryWrapper.eq("name",user.getName());
        queryWrapper.eq("password",user.getPassword());
        List<User>userList=userMapper.selectList(queryWrapper);
        return userList;
    }

    @Override
    public int addUser(User user) {
        int i=userMapper.insert(user);
        return i;
    }
}
